package cn.wolfcode.edu.service.impl;

import cn.wolfcode.edu.domain.SystemDictionary;
import cn.wolfcode.edu.mapper.SystemDictionaryMapper;
import cn.wolfcode.edu.service.ISystemDictionaryService;
import cn.wolfcode.edu.service.ISystemLogService;
import cn.wolfcode.edu.domain.SystemDictionaryItem;
import cn.wolfcode.edu.mapper.SystemDictionaryMapper;
import cn.wolfcode.edu.service.ISystemDictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by abb on 2018-07-11.
 */
@Service
public class SystemDictionaryServiceImpl implements ISystemDictionaryService{
    @Autowired
    SystemDictionaryMapper systemDictionaryMapper;

    @Override
    public void deleteByPrimaryKey(Long id) {
        systemDictionaryMapper.deleteByPrimaryKey(id);
    }

    @Override
    public void insert(SystemDictionary entity) {
        systemDictionaryMapper.insert(entity);
    }

    @Override
    public SystemDictionary selectByPrimaryKey(Long id) {
        return systemDictionaryMapper.selectByPrimaryKey(id);
    }

    @Override
    public List<SystemDictionary> selectAll() {
        return systemDictionaryMapper.selectAll();
    }

    @Override
    public void updateByPrimaryKey(SystemDictionary entity) {
        systemDictionaryMapper.updateByPrimaryKey(entity);
    }
    public List<SystemDictionaryItem> getItemBySn(String sn) {
        SystemDictionary sd = systemDictionaryMapper.getItemBySn(sn);
        return sd.getItems();
    }
}
